<%@page import="com.google.appengine.api.blobstore.BlobstoreServiceFactory" %>
<%@page import="com.google.appengine.api.blobstore.BlobstoreService" %>
<%@page import="com.google.appengine.api.blobstore.BlobKey" %>
<%@page import="com.google.appengine.api.images.ImagesServiceFactory" %>
<%@page import="com.google.appengine.api.images.ImagesService" %>
<%
     BlobstoreService blobstoreService 
          = BlobstoreServiceFactory.getBlobstoreService();
     //String uploadUrl = blobstoreService.createUploadUrl("/post");
%>
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>Post With File Test</title>
  </head>

  <body>
    <h1>Post With File Test</h1>
	<form action="<%=blobstoreService.createUploadUrl("/post")%>" method="post" enctype="multipart/form-data">
    <table>
		<tr>
			<th>Title</th>
			<td><input type="text" name="title" value="title"/></td>
		</tr>
		<tr>
			<th>Body</th>
			<td><input type="text" name="body" value="body"/></td>
		</tr>
      <tr>
        <td colspan="2"><input type="file" name="file1"/>
        <input type="file" name="file2"/>
        <input type="file" name="file3"/></td>        
      </tr>
      <tr>
        <td colspan="2"><input type="submit" value="Go"/></td>        
      </tr>
      <% if(request.getParameter("blobkey") != null){

      	BlobKey blobKey = new BlobKey(request.getParameter("blobkey"));
		ImagesService imagesService
		    = ImagesServiceFactory.getImagesService();

		//String imageUrl48 = imagesService.getServingUrl(blobKey, 48, false);
      %>
      <tr>
			<th>File URL:</th>
			<td><%=imagesService.getServingUrl(blobKey)%></td>
      </tr>
      <% } %>
    </table>
    </form>
  </body>
</html>
